﻿<!-- This file is part of DesktopGap (http://desktopgap.codeplex.com)
 ! Copyright (c) rubicon IT GmbH, Vienna, and contributors
 ! 
 ! This program is free software; you can redistribute it and/or
 ! modify it under the terms of the GNU General Public License
 ! as published by the Free Software Foundation; either version 2
 ! of the License, or (at your option) any later version.
 ! 
 ! This program is distributed in the hope that it will be useful,
 ! but WITHOUT ANY WARRANTY; without even the implied warranty of
 ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 ! GNU General Public License for more details.
 ! 
 ! You should have received a copy of the GNU General Public License
 ! along with this program; if not, write to the Free Software
 ! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 !
 ! Additional permissions are listed in the file DesktopGap_exceptions.txt.
 ! 
-->

<UserControl x:Class="DesktopGap.Clients.Windows.Components.CloseableTabHeader"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             mc:Ignorable="d" 
             Height="22px" 
             Background="{Binding Path=BackgroundBrush}">
    
    <UserControl.Resources>
        <BitmapImage x:Key="CloseButton" UriSource="/DesktopGap;component/Resources/close.png" />
    </UserControl.Resources>
    
    <Grid HorizontalAlignment="Stretch">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="16" />
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="20" />
        </Grid.ColumnDefinitions>
        
        <Image Width="16" Height="16" Margin="0 -2 0 0" Source="{Binding Path=Icon}" Grid.Column="0" /> 
        <Label Margin="0 -4 0 0" Content="{Binding Path=Text, FallbackValue='Loading ...'}" Grid.Column="1"/>
        <Button Visibility="{Binding Path=CloseButtonVisibility}" 
                Background="Transparent" 
                BorderBrush="Transparent" 
                Padding="1 0 1 0" 
                FontWeight="Bold"
                Click="CloseButton_Click"
                Grid.Column="2">
            <Image Margin="0 -2 0 0" Width="16" HorizontalAlignment="Right" >
                <Image.Source>
                    <StaticResource ResourceKey="CloseButton" />
                </Image.Source>
            </Image>
        </Button>
    </Grid>
</UserControl>
